import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
import home from '../views/Main/index.vue'
const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login/index.vue')
  },
  {
    path: '/register',
    name: '/register',
    component: () => import('../views/Register/index.vue')
  },
  {
    path: '/main',
    name: 'main',
    component: () => import('../App.vue'),
    redirect: '/main/home',
    children: [
      {
        path: 'home',
        name: 'home',
        component: home,
      },
      {
        path: 'setting',
        name: 'setting',
        component: () => import('../views/Setting/index.vue'),
      },
      {
        path: 'detail',
        name: 'detail',
        component: () => import('../views/ClassDetails/index.vue')
      },
      {
        path: 'member',
        name: 'member',
        component: () => import('../views/Member/index.vue')
      },
      {
        path: 'homework',
        name: 'homework',
        component: () => import('../views/HomeWork/index.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
